using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace EuropeEngulfed.NET
{
    class UIRegion
    {
        private uint regionID;
        private System.Drawing.Color mappedUIColor;

        private int alliedBlockIndex = 0;
        private int axisBlockIndex = 0;
        private int centredBlockIndex = 0;
        private int alliedGSUIndex = 0;
        private int axisGSUIndex = 0;

        private System.Drawing.Point pointForCentredBlocks;
        private System.Drawing.Point pointForCentredGSU;
        private System.Drawing.Point pointForContestedBlocks1;
        private System.Drawing.Point pointForContestedGSU1;
        private System.Drawing.Point pointForContestedBlocks2;
        private System.Drawing.Point pointForContestedGSU2;
        private System.Drawing.Point pointForFieldFortification;
        private System.Drawing.Point pointForBeachHead;
        private System.Drawing.Point pointCentre;

        public UIRegion(uint regionID, System.Drawing.Color mappedUIColor, Point pointForCentredBlocks, Point pointForCentredGSU, Point pointForContestedBlocks1, Point pointForContestedGSU1, Point pointForContestedBlocks2, Point pointForContestedGSU2, Point pointForFieldFortification, Point pointForBeachHead, Point pointCentre)
        {
            this.regionID = regionID;
            this.mappedUIColor = mappedUIColor;
            this.pointForCentredBlocks = pointForCentredBlocks;
            this.pointForCentredGSU = pointForCentredGSU;
            this.pointForContestedBlocks1 = pointForContestedBlocks1;
            this.pointForContestedGSU1 = pointForContestedGSU1;
            this.pointForContestedBlocks2 = pointForContestedBlocks2;
            this.pointForContestedGSU2 = pointForContestedGSU2;
            this.pointForFieldFortification = pointForFieldFortification;
            this.pointForBeachHead = pointForBeachHead;
            this.pointCentre = pointCentre;
        }

        public System.Drawing.Point PointCentre
        {
            get
            {
                return pointCentre;
            }
        }

        public System.Drawing.Point PointForContestedBlocks1
        {
            get
            {
                return pointForContestedBlocks1;
            }
        }

        public System.Drawing.Point PointForContestedGSU1
        {
            get
            {
                return pointForContestedGSU1;
            }
        }

        public System.Drawing.Point PointForContestedBlocks2
        {
            get
            {
                return pointForContestedBlocks2;
            }
        }

        public System.Drawing.Point PointForContestedGSU2
        {
            get
            {
                return pointForContestedGSU2;
            }
        }

        public System.Drawing.Point PointForCentredBlocks
        {
            get
            {
                return pointForCentredBlocks;
            }
        }

        public System.Drawing.Point PointForCentredGSU
        {
            get
            {
                return pointForCentredGSU;
            }
        }

        public System.Drawing.Point PointForFieldFortification
        {
            get
            {
                return pointForFieldFortification;
            }
        }

        public System.Drawing.Point PointForBeachHead
        {
            get
            {
                return pointForBeachHead;
            }
        }

        /////////////////////

        public int AlliedBlockIndex
        {
            get
            {
                return alliedBlockIndex;
            }

            set
            {
                alliedBlockIndex = value;
            }
        }

        public int  AxisBlockIndex
        {
            get
            {
                return axisBlockIndex;
            }

            set
            {
                axisBlockIndex = value;
            }
        }

        public int CentredBlockIndex
        {
            get
            {
                return centredBlockIndex;
            }

            set
            {
                centredBlockIndex = value;
            }
        }

        public int AlliedGSUIndex
        {
            get
            {
                return alliedGSUIndex;
            }

            set
            {
                alliedGSUIndex = value;
            }
        }

        public int AxisGSUIndex
        {
            get
            {
                return axisGSUIndex;
            }

            set
            {
                axisGSUIndex = value;
            }
        }

        public System.Drawing.Color MappedUIColor
        {
            get
            {
                return mappedUIColor;
            }
        }

        public uint RegionID
        {
            get
            {
                return regionID;
            }
        }

        public override string ToString()
        {
            return Enum.GetName(typeof(MapInfo.RegionID), this.regionID) +
                    " " + pointForCentredBlocks +
                    " " + pointForCentredGSU +
                    " " + pointForContestedBlocks1 +
                    " " + pointForContestedGSU1 +
                    " " + pointForContestedBlocks2 +
                    " " + pointForContestedGSU2 +
                    " " + pointForFieldFortification +
                    " " + pointForBeachHead +
                    " " + this.mappedUIColor;
        }

        public static Point GetUIPointForSpecialAction(MapInfo.CountryID country)
        {
            switch(country)
            {
                case MapInfo.CountryID.France:
                    return new Point(716, 1137);
                case MapInfo.CountryID.Germany:
                    return new Point(1193, 825);
                case MapInfo.CountryID.GreatBritain:
                    return new Point(665, 741);
                case MapInfo.CountryID.Italy:
                    return new Point(1279, 1475);
                case MapInfo.CountryID.Poland:
                    return new Point(1608, 773);
                case MapInfo.CountryID.Spain:
                    return new Point(322, 1644);
                case MapInfo.CountryID.Turkey:
                    return new Point(2256, 1437);
                case MapInfo.CountryID.USA:
                    return new Point(194, 220);
                case MapInfo.CountryID.USSR:
                    return new Point(2284, 288);
                case MapInfo.CountryID.Yugoslavia:
                    return new Point(1439, 1326);
                default:
                    throw new InvalidOperationException("Country cannot have special actions to display");
            }
        }
    }
}
